<?php
$score = [
    "PHP程序设计"=>1,
               "C语言"=>2,
               "数据库"=>3,
                "项目"=>4,
];
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<body>
    <table border="1">
        <thead>
            <tr>
                <th>PHP程序设计</th>
                <th>C语言</th>
                <th>数据库</th>
                <th>项目</th>
                <th>总分</th>
                <th>平均分</th>
            </tr>
        </thead>




        <?php
        $sum =0;
        foreach($score as $key=>$value){
            echo "<td>$value</td>";
            $sum += $value;
        }
        ?>
        <td><?php echo $sum;?></td>
        <td><?php echo $sum/count($score);?></td>
    </table>
</body>
</body>
</html>